package  grib2grd;
import java.io.File;
import java.util.Map;
import java.util.HashMap;
import java.util.Iterator;
import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.Element;
import org.dom4j.io.*;

public class Xmlloader {
	private Map <String,String>xmlMap = new HashMap<String,String>();
	public Xmlloader(String xmlFile){
		SAXReader readerX = new SAXReader();
		try {
			Document docX= readerX.read(new File(xmlFile));
			Element rootX = docX.getRootElement();
			
			for(Iterator i=rootX.elementIterator(); i.hasNext();){
				Element elem = (Element)i.next();
				xmlMap.put(elem.getName(),elem.getText());
				//System.out.println(elem.getName() + " = " + elem.getText());
			}
		} 
		catch (DocumentException e) {
			e.printStackTrace();
		}
		
	}
	public Map<String, String> getXmlMap() {
		return xmlMap;
	}
	
}

